version 8.2
capture clear
capture log close
set more off
set mem 1000m
set mat 800

use "Enterprise surveys_judicial_reforms_for merge with standardized dataset.dta"

keep countryname year reform_dum1 reform_dum_small1
sort countryname year
keep if countryname==countryname[_n-1]&year!=year[_n-1]
tab reform_dum1
tab reform_dum_small1

gen reform=3 if reform_dum1==1
replace reform=2 if reform_dum_small1==1
replace reform=1 if reform_dum1==0&reform_dum_small1==0
tab reform


ren countryname NAME
sort NAME
save "Judicial_reforms_for Map.dta", replace


***Map:

*Map from: http://thematicmapping.org/downloads/world_borders.php

*cd "C:\Users\mchemi\Documents\My Dropbox\judiciary\Cross-country analysis\data\map world\"
shp2dta using "TM_WORLD_BORDERS-0.3.shp", database(worlddb) coordinates(worldcoord) genid(id) replace


clear
use "worlddb"

****Harmonize name of countries:
replace NAME="Bahamas, The" if NAME=="Bahamas"
replace NAME="Cabo Verde" if NAME=="Cape Verde"
replace NAME="Congo, Dem. Rep." if NAME=="Democratic Republic of the Congo"
replace NAME="Congo, Rep." if NAME=="Congo"
replace NAME="Egypt, Arab Rep." if NAME=="Egypt"
replace NAME="Gambia, The" if NAME=="Gambia"
replace NAME="Hong Kong" if NAME=="Hong Kong SAR, China"
replace NAME="Iran, Islamic Rep." if NAME=="Iran (Islamic Republic of)"
replace NAME="Korea, Dem. People�s Rep." if NAME=="Korea, Democratic People's Republic of"
replace NAME="Korea, Rep." if NAME=="Korea, Republic of"
replace NAME="Kyrgyz Republic" if NAME=="Kyrgyzstan"
replace NAME="Lao PDR" if NAME=="Lao People's Democratic Republic"
replace NAME="Libya" if NAME=="Libyan Arab Jamahiriya"
replace NAME="Macao SAR, China" if NAME=="Macau"
replace NAME="Micronesia, Fed. Sts." if NAME=="Micronesia, Federated States of"
replace NAME="Myanmar" if NAME=="Burma"
replace NAME="Russian Federation" if NAME=="Russia"
replace NAME="Slovak Republic" if NAME=="Slovakia"
replace NAME="St. Kitts and Nevis" if NAME=="Saint Kitts and Nevis"
replace NAME="St. Lucia" if NAME=="Saint Lucia"
replace NAME="St. Martin (French part)" if NAME=="Saint Martin"
replace NAME="St. Vincent and the Grenadines" if NAME=="Saint Vincent and the Grenadines"
replace NAME="Taiwan, China" if NAME=="Taiwan"
replace NAME="Macedonia, FYR" if NAME=="The former Yugoslav Republic of Macedonia"
replace NAME="Tanzania" if NAME=="United Republic of Tanzania"
replace NAME="Venezuela, RB" if NAME=="Venezuela"
replace NAME="Vietnam" if NAME=="Viet Nam"
replace NAME="West Bank and Gaza" if NAME=="Palestine"
replace NAME="Yemen, Rep." if NAME=="Yemen"
replace NAME="Moldova" if NAME=="Republic of Moldova"

sort NAME
merge 1:1 NAME using "Judicial_reforms_for Map.dta"

sort NAME
*browse NAME _merge reform_dum4

*with 1, 0.1, -1:
*spmap reform using "data\map world\worldcoord", id(id) clmethod(custom) clbreaks(-1.5 -0.2 0 0.2 1.5) fcolor(RdYlGn)
*graph export "Paper\Map Reforms.png", replace

spmap reform using "worldcoord", id(id) clmethod(custom) clbreaks(0.5 1.5 2.5 3.5) fcolor(Greys) legenda(on) ///
 legend(label(1 "No World Bank Enterprise Surveys") label(2 "No Judicial Reform") label(3 "Limited Judicial Reform") label(4 "Comprehensive Judicial Reform"))
graph export "Figure C7 Map Reforms.png", replace




